/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package musicbeach;

import com.trolltech.qt.QVariant;
import com.trolltech.qt.core.QSize;
import com.trolltech.qt.core.Qt;
import com.trolltech.qt.gui.QCloseEvent;
import com.trolltech.qt.gui.QFont;
import com.trolltech.qt.gui.QGridLayout;
import com.trolltech.qt.gui.QLabel;
import com.trolltech.qt.gui.QLineEdit;
import com.trolltech.qt.gui.QPushButton;
import com.trolltech.qt.gui.QWidget;

/**
 *
 * @author Radek
 */
public class LogingWindow extends QWidget 
{
    private Application handler;
    
    public void LogingWindow()
    {
        parent();
    }
    
    public void init(Application handler)
    {
        this.handler = handler;
        
        QSize size = QVariant.toSize(new QSize(200, 200));
        this.setFixedSize(size);
        
        this.setWindowTitle("Zaloguj");
        
        QGridLayout grid = new QGridLayout();
        
        QLabel label = new QLabel();
        label.setText("Zaloguj");
        label.setFont(new QFont("Arial", 12, 600));
        
        
        QLabel labelLogin = new QLabel();
        labelLogin.setText("Login:");
        
        QLineEdit loginText = new QLineEdit();
        
        QLabel labelPassword = new QLabel();
        labelPassword.setText("Hasło:");
        
        
        QLineEdit passwordText = new QLineEdit();
        passwordText.setEchoMode(QLineEdit.EchoMode.Password);
        
        QPushButton logButton = new QPushButton("Zaloguj");        
        QPushButton registerButton = new QPushButton("Zarejestruj");

        
        grid.addWidget(label);        
        grid.addWidget(labelLogin);        
        grid.addWidget(loginText);

        grid.addWidget(labelPassword);        
        grid.addWidget(passwordText);        
        
        grid.addWidget(logButton);
        grid.addWidget(registerButton);

        this.setLayout(grid);
        
        this.setWindowModality(Qt.WindowModality.WindowModal);
    }
    
    @Override
    public void closeEvent(QCloseEvent event)
    {
        handler.setDisabled(false);
        event.accept();
    }
}
